//
//  QuestionDetailViewController.m
//  TeamInformatization
//
//  Created by bigger on 2019/4/2.
//  Copyright © 2019年 SPIC. All rights reserved.
//

#import "QuestionDetailViewController.h"
#import "WorkQuestionView.h"
#import "QuestionDealView.h"

@interface QuestionDetailViewController () <QuestionDealViewDelegate>

@end

@implementation QuestionDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self showTitleBarWithTitle:@"问题详情" leftButtonStyle:Base_NavigationBar_Back rightButtonStyle:Base_NavigationBar_None];
    
    
    // UI
    [self loadShowViews];
}

// UI
- (void)loadShowViews
{
    UIScrollView * bgScrollView = [[UIScrollView alloc] init];
    bgScrollView.backgroundColor = kCommonBGGaryColor;
    bgScrollView.bounces = NO;
    bgScrollView.showsVerticalScrollIndicator = NO;
    bgScrollView.userInteractionEnabled = YES;
    bgScrollView.contentSize = CGSizeMake(kScreenWidth, kScreenHeight * 2);
    [self.view addSubview:bgScrollView];
    [bgScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(kSafeAreaTopHeight);
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    
    
    WorkQuestionView *workQuestionView = [[WorkQuestionView alloc] initWithShowType:1];
    [bgScrollView addSubview:workQuestionView];
    [workQuestionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.centerX.mas_equalTo(bgScrollView);
        make.width.mas_equalTo(kScreenWidth);
    }];
    
    QuestionDealView *dealView = [[QuestionDealView alloc] init];
    dealView.delegate = self;
    [bgScrollView addSubview:dealView];
    [dealView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(workQuestionView.mas_bottom).offset(10 * kScaleWidth);
        make.width.mas_equalTo(kScreenWidth);
        make.height.mas_equalTo(103 * kScaleWidth);
    }];
    
    UIButton *confirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [confirmButton setCommonStyleAndShowText:@"确认"];
    [bgScrollView addSubview:confirmButton];
    [confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(dealView.mas_bottom).offset(33 * kScaleWidth);
        make.centerX.mas_equalTo(bgScrollView);
        make.size.mas_equalTo(CGSizeMake(kScreenWidth - 30 * kScaleWidth, 44 * kScaleWidth));
        make.bottom.mas_equalTo(-46 * kScaleWidth);
    }];
    
}

#pragma mark - QuestionDealViewDelegate
- (void)getSelectNum:(int)selectNum DataDict:(NSDictionary *)dataDict withQuestionDealView:(QuestionDealView *)questionDealView
{
    switch (selectNum) {
        case 0: {
            [questionDealView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(103 * kScaleWidth);
            }];
            break;
        }
        case 1: {
            [questionDealView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(254 * kScaleWidth);
            }];
            break;
        }
        case 2: {
            [questionDealView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(204 * kScaleWidth);
            }];
            break;
        }
        default:
            break;
    }
    
}


#pragma -导航栏 两边按钮操作
-(void)baseNavigationBarLeftButtonClick:(UIButton *)button
{
    [self.navigationController popViewControllerAnimated:YES];
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
